<template>
	<view>
		<page-head headTitle="商家认证" :returnButton="true" @clickLeftReturn="clickLeftReturn"></page-head>
		<form>
			<view class="bg-white m-t9">
				<view class="m-l-r flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">店铺名称</text>
					<view><input v-model="name" class="fs-3" type="text" placeholder-class="fs-3 placeholder" placeholder="请输入店铺名称"></view>
				</view>
				<view class="m-l-r flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">企业名称</text>
					<view><input v-model="enterprise" class="fs-3" type="text" placeholder-class="fs-3 placeholder" placeholder="请输入企业名称"></view>
				</view>
				<view class="m-l-r flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">注&nbsp;册&nbsp;号</text>
					<view><input v-model="enterprise_register_no" class="fs-3" type="text" placeholder-class="fs-3 placeholder" placeholder="请输入注册号码"></view>
				</view>
				<view class="m-l-r flex height align-center">
					<text class="text fs-3 width-1 letter-s">组织机构代码</text>
					<view><input v-model="organization_code" class="fs-3" type="text" placeholder-class="fs-3 placeholder"></view>
				</view>
			</view>
			<upload-image :image="image"></upload-image>
			<!-- <prompt-language content="*认证失败：您的营业执照与企业名称不符"></prompt-language>
			<bright-button title="提交认证"></bright-button>
			<bright-button title="再次认证"></bright-button> -->
			<grey-button title="已认证" class="m-b4"></grey-button>
		</form>
	</view>
</template>

<script>	
import pageHead from '@/components/common/page-head.vue'
import uploadImage from '@/components/common/upload-image.vue'
import brightButton from '@/components/common/bright-button.vue'
import greyButton from '@/components/common/grey-button.vue'
import promptLanguage from '@/components/common/prompt-language.vue'
	export default {
		components:{
			pageHead,
			uploadImage,
			promptLanguage,
			brightButton,
			greyButton
			
		},
		data() {
			return {
				image:'/static/images/business-license.png',
				name:'',
				enterprise:'',
				enterprise_register_no:'',
				organization_code:''	
			}
		},
		onLoad(){
			this.getStatus();
		},
		methods: {
			clickLeftReturn(){
				const pages = getCurrentPages() ;
				if(pages.length >1) {
					uni.navigateBack({
						delta: 1
					});
				}else{
					//返回上一页失败后强制回到首页
					uni.redirectTo({
						url: '../index/index'
					})
				}
			},
			//判断是否已认证
			getStatus(){
				this.$myRequest({
					method:'POST',
					url:'/api/merchant/authinfo'
				}).then(res=>{
					console.log(res);
					if(res.data.code == 1){
						let data = res.data.data.info;
						this.image = data.authentication_imgs;
						this.name = data.name;
						this.enterprise = data.enterprise;
						this.enterprise_register_no = data.enterprise_register_no;
						this.organization_code = data.organization_code;
					}
					
				})
			},
		}
	}
</script>

<style>

</style>
